package com.yicong.ants.manager.http

import com.yicong.ants.bean.base.ArrayListRespBean
import com.yicong.ants.bean.base.RespBean
import com.yicong.ants.scenic.data.CityInfo
import com.yicong.ants.scenic.data.PageData
import com.yicong.ants.scenic.data.ScenicDetail
import com.yicong.ants.scenic.data.ScenicItem
import com.yicong.ants.scenic.data.Ticket
import com.yicong.ants.scenic.data.TicketOrder
import com.yicong.ants.scenic.data.WeatherInfo
import io.reactivex.Observable
import kotlinx.coroutines.flow.Flow
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

interface ScenicApis {
    @FormUrlEncoded
    @POST("/api/v2/ticket/cityList")
    fun getCityList(@Field("a") a: String = "a"): Observable<ArrayListRespBean<CityInfo>>

    @FormUrlEncoded
    @POST("/api/v2/ticket/scenicList")
    fun getScenicList(
        @Field("keyWord") keyWord: String,
        @Field("pageIndex") pageIndex: Int,
        @Field("pageSize") pageSize: Int = 48,
        @Field("sort") sort: Int = 0,
        @Field("cityName") cityName: String? = null,
        @Field("provinceName") provinceName: String? = null,
        @Field("longitude") longitude: String? = null,
        @Field("latitude") latitude: String? = null,
    ): Observable<RespBean<PageData<ScenicItem>?>>

    @FormUrlEncoded
    @POST("/api/v2/ticket/scenicDetail")
    fun getScenicDetail(@Field("scenicID") id: String): Observable<RespBean<ScenicDetail>>

    @FormUrlEncoded
    @POST("/api/v2/ticket/ticketDetail")
    fun getTicketDetail(@Field("productId") id: String): Observable<RespBean<Ticket>>


    @FormUrlEncoded
    @POST("/api/v2/ticket/createOrder")
    fun createOrder(
        @Field("scenicID") scenicID: String,
        @Field("productID") productID: String,
        @Field("travelDate") travelDate: String,
        @Field("friendMobile") friendMobile: String? = null
    ): Observable<RespBean<TicketOrder>>

    @FormUrlEncoded
    @POST("/api/v2/ticket/orderDetail")
    fun getOrderDetail(
        @Field("customerOrderNo") customerOrderNo: String
    ): Observable<RespBean<TicketOrder>>

    @FormUrlEncoded
    @POST("/api/v2/ticket/orderList")
    fun getOrderList(
        @Field("page") page: Int,
        @Field("limit") limit: Int = 48
    ): Observable<RespBean<PageData<TicketOrder>>>

    @FormUrlEncoded
    @POST("/api/v2/address/getWeather")
    fun getWeather(
        @Field("location") location: String
    ): Observable<RespBean<WeatherInfo>>

    @FormUrlEncoded
    @POST("/api/v2/ticket/getFriendInfo")
    fun getFriendInfo(
        @Field("mobile") mobile: String
    ): Observable<RespBean<Ticket>>

    @FormUrlEncoded
    @POST("/api/v2/ticket/cancelOrder")
    fun cancelOrder(
        @Field("customerOrderNo") customerOrderNo: String
    ): Observable<RespBean<Any>>

    @FormUrlEncoded
    @POST("/api/v2/ticket/payOrder")
    fun payOrder(
        @Field("customerOrderNo") customerOrderNo: String,
        @Field("pwd") pwd: String
    ): Observable<RespBean<Any>>
}